﻿using System;
using System.Data ;
using System.Linq;
using LayerData;
using LayerData.Compras ;
using LayerEntity.Compras ;
namespace LayerLogic.Compras
{
    public class LCompras
    {
        #region Variables
        IPostgreSqlConnectionInfo con;
        readonly DCompra compra;
        #endregion

        #region Constructores
        public LCompras(IPostgreSqlConnectionInfo coninfo) {
            con = coninfo;
            compra = new DCompra(coninfo);
        }
        #endregion

        #region Propiedades
        public IPostgreSqlConnectionInfo CurrentConnection {
            get {
                return con;
            }
            set {
                con = value;
            }
        }
        #endregion

        #region Funciones
        public DataTable GetTiposFlete()
        {
            DataTable dtb = new DataTable();
            dtb.Columns.Add(new DataColumn("Id", typeof (int)));
            dtb.Columns.Add(new DataColumn("Descripcion",typeof (string)));

            dtb.Rows.Add(1, "Peso");
            dtb.Rows.Add(2, "Volumen");
            return dtb;
        }

        public int RegistrarCompra(ECompra c) {
            return compra.RegistraFactura(c);
        }
        #endregion
    }
}